package com.smile.service.entity.organization;

import com.alibaba.fastjson2.annotation.JSONField;

import java.util.List;

public class AirportBindStatusData {

    @JSONField(alternateNames = "devices")
    private List<BoundDevice> devices;

    // 嵌套类 - 绑定设备信息
    public static class BoundDevice {
        @JSONField(alternateNames = "sn")
        private String serialNumber;

        // Getter & Setter
        public String getSerialNumber() {
            return serialNumber;
        }

        public void setSerialNumber(String serialNumber) {
            this.serialNumber = serialNumber;
        }

        @Override
        public String toString() {
            return "BoundDevice{" +
                    "serialNumber='" + serialNumber + '\'' +
                    '}';
        }
    }

    // Getter & Setter
    public List<BoundDevice> getDevices() {
        return devices;
    }

    public void setDevices(List<BoundDevice> devices) {
        this.devices = devices;
    }

    // 实用方法：获取所有绑定设备的SN列表
//    public List<String> getDeviceSNs() {
//        if (devices == null || devices.isEmpty()) {
//            return List.of();
//        }
//        return devices.stream().map(BoundDevice::getSerialNumber).toList();
//    }

    // 实用方法：检查是否绑定了特定设备
//    public boolean containsDevice(String sn) {
//        if (devices == null) {
//            return false;
//        }
//        return devices.stream().anyMatch(device ->
//                device.getSerialNumber().equals(sn));
//    }

    @Override
    public String toString() {
        return "AirportBindStatusData{" +
                "devices=" + (devices != null ? devices : "[]") +
                '}';
    }
}
